/**
 * 给两个矩阵，只有一个地方不同，找出来
 */
#include <bits/stdc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vll = vector<llt>;

template<typename T>
void input(vector<T> & a, int n){
    a.assign(n + 1, {});
    for(int i=1;i<=n;++i) cin >> a[i];
    return;
}

template<typename T>
istream & operator >> (istream & is, vector<T> & v){
    for(auto & i : v) is >> i;
    return is;
}

int N;
vector<string> A, B;

void work(){
    cin >> N;
    A.assign(N, "");
    B.assign(N, "");
    cin >> A >> B;
    for(int i=0;i<N;++i)for(int j=0;j<N;++j){
        if(A[i][j] != B[i][j]){
            cout << i + 1 << " " << j + 1 << endl;
            return;
        }
    }
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}